//
//  HypotacticWestCell.m
//  CJRailTransport
//
//  Created by Hank on 2017/11/30.
//  Copyright © 2017年 amplity. All rights reserved.
//

#import "HypotacticWestCell.h"
#import "DrCorner.h"
#import "UIView+Expand.h"

@implementation HypotacticWestCell

- (void)layoutSubviews
{
    [super layoutSubviews];
    // 更新约束后的Frame
    [self.contentView setNeedsLayout];
    [self.contentView layoutIfNeeded];
    // 设置圆角
    [self setRadius];
}
// 设置圆角
- (void)setRadius
{
    [self.stentsNumberBg radiusView:3 backgroundColor:[UIColor clearColor] borderWidth:0.5 borderColor:[UIColor blackColor]];
    [self.trayNumberBg radiusView:3 backgroundColor:[UIColor clearColor] borderWidth:0.5 borderColor:[UIColor blackColor]];
    [self.stentsTopVINBg radiusView:3 backgroundColor:[UIColor clearColor] borderWidth:0.5 borderColor:[UIColor blackColor]];
    [self.stentsBottomVIN radiusView:3 backgroundColor:[UIColor clearColor] borderWidth:0.5 borderColor:[UIColor blackColor]];
    [self.trayVINBg radiusView:3 backgroundColor:[UIColor clearColor] borderWidth:0.5 borderColor:[UIColor blackColor]];
}

// 设置数据
- (void)setData:(QueryDetailListModel *)queryDetailListModel vin:(NSString *)vin
{
    // 遍历设置数据
    for (int i = 0; i < queryDetailListModel.retmarkobj.list.count; i++) {
        // 内容 Model
        QueryDetailListContentModel *queryDetailListContentModel = queryDetailListModel.retmarkobj.list[i];
        // 判断支架或托盘位置
        if ([queryDetailListContentModel.rackLocation isEqualToString:@"1"]) {
            // 上支架车辆VIN编号
            self.stentsTopVIN.text = queryDetailListContentModel.carId;
            // 支架编号
            self.stentsNumber.text = queryDetailListContentModel.rackId;
        }else if ([queryDetailListContentModel.rackLocation isEqualToString:@"2"]) {
            // 下支架车辆VIN编号
            self.stentsBottomVIN.text = queryDetailListContentModel.carId;
            // 支架编号
            self.stentsNumber.text = queryDetailListContentModel.rackId;
        }else if ([queryDetailListContentModel.rackLocation isEqualToString:@"3"]) {
            // 托盘上车辆VIN编号
            self.trayVIN.text = queryDetailListContentModel.carId;
            // 托盘编号
            self.trayNumber.text = queryDetailListContentModel.rackId;
        }
    }
}

//  去除分割线
- (UIView *)lineView
{
    return [[UIView alloc]init];
}

#pragma makr - Action
// 跳转到详细页面
- (IBAction)skipDetailAction:(UIButton *)sender
{
    NSString *vin = @"";
    if (sender.tag == 1) {
        vin = self.stentsNumber.text;
    }else{
        vin = self.trayNumber.text;
    }
    _skipDetailBlock(sender.tag, vin);
}

@end
